﻿using _047_ObserverSample;
using static System.Console;

// 创建主题
WeatherStation weatherStation = new WeatherStation();

// 创建观察者
TemperatureDisplay temperatureDisplay = new TemperatureDisplay();
HumidityDisplay humidityDisplay = new HumidityDisplay();

// 注册观察者
weatherStation.RegisterObserver(temperatureDisplay);
weatherStation.RegisterObserver(humidityDisplay);

// 模拟天气数据更新
weatherStation.SetMeasurements(25.0f, 65.0f, 1013.0f);

Console.WriteLine("------");

// 移除一个观察者
weatherStation.RemoveObserver(humidityDisplay);
weatherStation.SetMeasurements(25.0f, 65.0f, 1013.0f);

ReadLine();